.class public Lcom/opongo/blogapp/activities/BookmarksListActivity;
.super Lcom/opongo/blogapp/activities/AbstractPostsListActivity;
.source "BookmarksListActivity.java"


# static fields
.field public static final DEBUG:Z

.field private static final TAG:Ljava/lang/String;


# instance fields
.field private cursor:Landroid/database/Cursor;

.field private primaryIndex:I

.field private selectDelete:Z


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 29
    sget-boolean v0, Lcom/opongo/blogapp/AbaSettings;->DEBUG:Z

    sput-boolean v0, Lcom/opongo/blogapp/activities/BookmarksListActivity;->DEBUG:Z

    .line 30
    const-class v0, Lcom/opongo/blogapp/activities/BookmarksListActivity;

    .line 31
    invoke-virtual {v0}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;

    move-result-object v0

    .line 30
    sput-object v0, Lcom/opongo/blogapp/activities/BookmarksListActivity;->TAG:Ljava/lang/String;

    .line 26
    return-void
.end method

.method public constructor <init>()V
    .locals 1

    .prologue
    .line 26
    invoke-direct {p0}, Lcom/opongo/blogapp/activities/AbstractPostsListActivity;-><init>()V

    .line 34
    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/opongo/blogapp/activities/BookmarksListActivity;->selectDelete:Z

    .line 26
    return-void
.end method

.method static synthetic access$0(Lcom/opongo/blogapp/activities/BookmarksListActivity;Z)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 34
    iput-boolean p1, p0, Lcom/opongo/blogapp/activities/BookmarksListActivity;->selectDelete:Z

    return-void
.end method

.method private openDeleteDialog()V
    .locals 3

    .prologue
    .line 124
    new-instance v1, Landroid/app/AlertDialog$Builder;

    invoke-direct {v1, p0}, Landroid/app/AlertDialog$Builder;-><init>(Landroid/content/Context;)V

    invoke-virtual {v1}, Landroid/app/AlertDialog$Builder;->create()Landroid/app/AlertDialog;

    move-result-object v0

    .line 125
    .local v0, alertDialog:Landroid/app/AlertDialog;
    const v1, 0x7f070043

    invoke-virtual {p0, v1}, Lcom/opongo/blogapp/activities/BookmarksListActivity;->getString(I)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/app/AlertDialog;->setTitle(Ljava/lang/CharSequence;)V

    .line 127
    const v1, 0x7f070044

    invoke-virtual {p0, v1}, Lcom/opongo/blogapp/activities/BookmarksListActivity;->getString(I)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/app/AlertDialog;->setMessage(Ljava/lang/CharSequence;)V

    .line 128
    const v1, 0x7f020009

    invoke-virtual {v0, v1}, Landroid/app/AlertDialog;->setIcon(I)V

    .line 130
    const-string v1, "OK"

    new-instance v2, Lcom/opongo/blogapp/activities/BookmarksListActivity$1;

    invoke-direct {v2, p0}, Lcom/opongo/blogapp/activities/BookmarksListActivity$1;-><init>(Lcom/opongo/blogapp/activities/BookmarksListActivity;)V

    invoke-virtual {v0, v1, v2}, Landroid/app/AlertDialog;->setButton(Ljava/lang/CharSequence;Landroid/content/DialogInterface$OnClickListener;)V

    .line 135
    invoke-virtual {v0}, Landroid/app/AlertDialog;->show()V

    .line 136
    return-void
.end method

.method private removeBookmark(I)V
    .locals 3
    .parameter "key"

    .prologue
    .line 101
    iget-object v0, p0, Lcom/opongo/blogapp/activities/BookmarksListActivity;->dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

    new-instance v1, Ljava/lang/StringBuilder;

    const-string v2, "DELETE FROM bookmarks WHERE _id="

    invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    .line 102
    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    .line 101
    invoke-virtual {v0, v1}, Lcom/opongo/blogapp/manager/DatabaseManager;->execQuery(Ljava/lang/String;)V

    .line 103
    iget-object v0, p0, Lcom/opongo/blogapp/activities/BookmarksListActivity;->cursor:Landroid/database/Cursor;

    invoke-interface {v0}, Landroid/database/Cursor;->requery()Z

    .line 104
    iget-object v0, p0, Lcom/opongo/blogapp/activities/BookmarksListActivity;->mAdapter:Lcom/opongo/blogapp/adapter/PostListAdapter;

    invoke-virtual {v0}, Lcom/opongo/blogapp/adapter/PostListAdapter;->notifyDataSetChanged()V

    .line 105
    return-void
.end method


# virtual methods
.method protected doRefresh(Z)V
    .locals 0
    .parameter "forceRefresh"

    .prologue
    .line 145
    return-void
.end method

.method public onContextItemSelected(Landroid/view/MenuItem;)Z
    .locals 5
    .parameter "item"

    .prologue
    .line 89
    .line 90
    invoke-interface {p1}, Landroid/view/MenuItem;->getMenuInfo()Landroid/view/ContextMenu$ContextMenuInfo;

    move-result-object v1

    .line 89
    check-cast v1, Landroid/widget/AdapterView$AdapterContextMenuInfo;

    .line 92
    .local v1, info:Landroid/widget/AdapterView$AdapterContextMenuInfo;,"Landroid/widget/AdapterView$AdapterContextMenuInfo;"
    invoke-virtual {p0}, Lcom/opongo/blogapp/activities/BookmarksListActivity;->getListView()Landroid/widget/ListView;

    move-result-object v3

    .line 93
    iget v4, v1, Landroid/widget/AdapterView$AdapterContextMenuInfo;->position:I

    invoke-virtual {v3, v4}, Landroid/widget/ListView;->getItemAtPosition(I)Ljava/lang/Object;

    move-result-object v0

    .line 92
    check-cast v0, Landroid/database/Cursor;

    .line 94
    .local v0, c:Landroid/database/Cursor;
    iget v3, p0, Lcom/opongo/blogapp/activities/BookmarksListActivity;->primaryIndex:I

    invoke-interface {v0, v3}, Landroid/database/Cursor;->getInt(I)I

    move-result v2

    .line 95
    .local v2, key:I
    invoke-direct {p0, v2}, Lcom/opongo/blogapp/activities/BookmarksListActivity;->removeBookmark(I)V

    .line 97
    const/4 v3, 0x1

    return v3
.end method

.method public onCreate(Landroid/os/Bundle;)V
    .locals 6
    .parameter "savedInstanceState"

    .prologue
    .line 39
    sget-boolean v0, Lcom/opongo/blogapp/activities/BookmarksListActivity;->DEBUG:Z

    if-eqz v0, :cond_0

    .line 40
    sget-object v0, Lcom/opongo/blogapp/activities/BookmarksListActivity;->TAG:Ljava/lang/String;

    const-string v1, "*** create ***"

    invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 42
    :cond_0
    invoke-super {p0, p1}, Lcom/opongo/blogapp/activities/AbstractPostsListActivity;->onCreate(Landroid/os/Bundle;)V

    .line 44
    const v0, 0x7f030002

    invoke-virtual {p0, v0}, Lcom/opongo/blogapp/activities/BookmarksListActivity;->setContentView(I)V

    .line 46
    new-instance v0, Lcom/opongo/blogapp/manager/DatabaseManager;

    const-string v1, "bookmarks"

    .line 47
    const-string v2, "INSERT INTO bookmarks (id,title,date,content,categories,commentscount,imageurl,post_order,guid,opened,newpost,did_vote,post_author,post_price,post_rating) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);"

    invoke-direct {v0, p0, v1, v2}, Lcom/opongo/blogapp/manager/DatabaseManager;-><init>(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)V

    .line 46
    iput-object v0, p0, Lcom/opongo/blogapp/activities/BookmarksListActivity;->dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

    .line 49
    const-string v0, "SELECT * FROM bookmarks ORDER BY date DESC"

    iput-object v0, p0, Lcom/opongo/blogapp/activities/BookmarksListActivity;->query:Ljava/lang/String;

    .line 53
    iget-object v0, p0, Lcom/opongo/blogapp/activities/BookmarksListActivity;->dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

    iget-object v1, p0, Lcom/opongo/blogapp/activities/BookmarksListActivity;->query:Ljava/lang/String;

    invoke-virtual {v0, v1}, Lcom/opongo/blogapp/manager/DatabaseManager;->query(Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v0

    iput-object v0, p0, Lcom/opongo/blogapp/activities/BookmarksListActivity;->cursor:Landroid/database/Cursor;

    .line 55
    new-instance v0, Lcom/opongo/blogapp/adapter/PostListAdapter;

    const v3, 0x7f03000f

    .line 56
    iget-object v4, p0, Lcom/opongo/blogapp/activities/BookmarksListActivity;->cursor:Landroid/database/Cursor;

    iget-object v1, p0, Lcom/opongo/blogapp/activities/BookmarksListActivity;->dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

    invoke-virtual {v1}, Lcom/opongo/blogapp/manager/DatabaseManager;->getTableName()Ljava/lang/String;

    move-result-object v5

    move-object v1, p0

    move-object v2, p0

    invoke-direct/range {v0 .. v5}, Lcom/opongo/blogapp/adapter/PostListAdapter;-><init>(Landroid/app/Activity;Landroid/content/Context;ILandroid/database/Cursor;Ljava/lang/String;)V

    .line 55
    iput-object v0, p0, Lcom/opongo/blogapp/activities/BookmarksListActivity;->mAdapter:Lcom/opongo/blogapp/adapter/PostListAdapter;

    .line 58
    iget-object v0, p0, Lcom/opongo/blogapp/activities/BookmarksListActivity;->cursor:Landroid/database/Cursor;

    invoke-virtual {p0, v0}, Lcom/opongo/blogapp/activities/BookmarksListActivity;->startManagingCursor(Landroid/database/Cursor;)V

    .line 60
    iget-object v0, p0, Lcom/opongo/blogapp/activities/BookmarksListActivity;->mAdapter:Lcom/opongo/blogapp/adapter/PostListAdapter;

    invoke-virtual {p0, v0}, Lcom/opongo/blogapp/activities/BookmarksListActivity;->setListAdapter(Landroid/widget/ListAdapter;)V

    .line 62
    invoke-virtual {p0}, Lcom/opongo/blogapp/activities/BookmarksListActivity;->getListView()Landroid/widget/ListView;

    move-result-object v0

    invoke-virtual {p0, v0}, Lcom/opongo/blogapp/activities/BookmarksListActivity;->registerForContextMenu(Landroid/view/View;)V

    .line 63
    return-void
.end method

.method public onCreateContextMenu(Landroid/view/ContextMenu;Landroid/view/View;Landroid/view/ContextMenu$ContextMenuInfo;)V
    .locals 2
    .parameter "menu"
    .parameter "view"
    .parameter "menuInfo"

    .prologue
    const/4 v1, 0x0

    .line 81
    invoke-super {p0, p1, p2, p3}, Lcom/opongo/blogapp/activities/AbstractPostsListActivity;->onCreateContextMenu(Landroid/view/ContextMenu;Landroid/view/View;Landroid/view/ContextMenu$ContextMenuInfo;)V

    .line 82
    const v0, 0x7f070045

    invoke-interface {p1, v0}, Landroid/view/ContextMenu;->setHeaderTitle(I)Landroid/view/ContextMenu;

    .line 83
    const v0, 0x7f020009

    invoke-interface {p1, v0}, Landroid/view/ContextMenu;->setHeaderIcon(I)Landroid/view/ContextMenu;

    .line 84
    const v0, 0x7f070046

    invoke-virtual {p0, v0}, Lcom/opongo/blogapp/activities/BookmarksListActivity;->getString(I)Ljava/lang/String;

    move-result-object v0

    invoke-interface {p1, v1, v1, v1, v0}, Landroid/view/ContextMenu;->add(IIILjava/lang/CharSequence;)Landroid/view/MenuItem;

    .line 85
    return-void
.end method

.method public onCreateOptionsMenu(Landroid/view/Menu;)Z
    .locals 2
    .parameter "menu"

    .prologue
    .line 109
    invoke-virtual {p0}, Lcom/opongo/blogapp/activities/BookmarksListActivity;->getMenuInflater()Landroid/view/MenuInflater;

    move-result-object v0

    const/high16 v1, 0x7f0e

    invoke-virtual {v0, v1, p1}, Landroid/view/MenuInflater;->inflate(ILandroid/view/Menu;)V

    .line 111
    const/4 v0, 0x1

    return v0
.end method

.method protected onListItemClick(Landroid/widget/ListView;Landroid/view/View;IJ)V
    .locals 3
    .parameter "l"
    .parameter "v"
    .parameter "position"
    .parameter "id"

    .prologue
    .line 68
    invoke-virtual {p1, p3}, Landroid/widget/ListView;->getItemAtPosition(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/database/Cursor;

    .line 69
    .local v0, c:Landroid/database/Cursor;
    iget v2, p0, Lcom/opongo/blogapp/activities/BookmarksListActivity;->primaryIndex:I

    invoke-interface {v0, v2}, Landroid/database/Cursor;->getInt(I)I

    move-result v1

    .line 71
    .local v1, key:I
    iget-boolean v2, p0, Lcom/opongo/blogapp/activities/BookmarksListActivity;->selectDelete:Z

    if-eqz v2, :cond_0

    .line 72
    invoke-direct {p0, v1}, Lcom/opongo/blogapp/activities/BookmarksListActivity;->removeBookmark(I)V

    .line 76
    :goto_0
    return-void

    .line 74
    :cond_0
    invoke-super/range {p0 .. p5}, Lcom/opongo/blogapp/activities/AbstractPostsListActivity;->onListItemClick(Landroid/widget/ListView;Landroid/view/View;IJ)V

    goto :goto_0
.end method

.method public onOptionsItemSelected(Landroid/view/MenuItem;)Z
    .locals 3
    .parameter "item"

    .prologue
    const/4 v2, 0x1

    .line 115
    invoke-interface {p1}, Landroid/view/MenuItem;->getItemId()I

    move-result v0

    const v1, 0x7f08005a

    if-ne v0, v1, :cond_0

    .line 116
    invoke-direct {p0}, Lcom/opongo/blogapp/activities/BookmarksListActivity;->openDeleteDialog()V

    .line 119
    :cond_0
    return v2
.end method

.method public onStart()V
    .locals 0

    .prologue
    .line 140
    invoke-super {p0}, Lcom/opongo/blogapp/activities/AbstractPostsListActivity;->superOnStart()V

    .line 141
    return-void
.end method
